<!DOCTYPE html>
<html>
<body>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<input type=url>
<script>
var input = document.querySelector('input');
input.focus();

test(function() {
    eventSender.keyDown(' ');
    eventSender.keyDown('h');
    eventSender.keyDown('t');
    eventSender.keyDown('t');
    eventSender.keyDown('p');
    eventSender.keyDown('\r');
    eventSender.keyDown(':');
    eventSender.keyDown('/');
    eventSender.keyDown('/');
    eventSender.keyDown(' ');
    assert_equals(input.value, ' http:// ');
    input.setSelectionRange(0, input.value.length);
    assert_equals(window.getSelection().toString(), ' http:// ');
}, 'URL input preserve user-input whitespaces.');
</script>
</body>
</html>
